package com.demo.connectdbtest.module.live.contrller;

import com.demo.connectdbtest.module.live.service.LiveService;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;


/**
 * 描述：
 *
 * @author: chengc
 * @date 2022/03/28
 */
@RestController
@RequestMapping("/api/live")
//@Api(tags = "导出相关接口")
public class LiveController {

    private static final Logger log = LoggerFactory.getLogger(LiveController.class);

    @Autowired
    private LiveService liveService;

    @ApiOperation(value = "导出不同时间点的直播人数")
    @GetMapping("/live/num/export")
    public void exportLiveNum(@RequestParam("startTime") Long startTime, @RequestParam("endTime") Long endTime, HttpServletResponse response) {
        try {
            liveService.exportLiveNum(startTime, endTime, response);
        } catch (Exception e) {
            log.error("导出不同时间点的直播人数error={}",e);
        }

    }
}
